
Xander Hunt
3
|
Posted - 2011.12.18 14:12:00 -
[1] - Quote
Dude, this is pretty damned sweet. At first, when I looked at this entire project I thought it was another PHP framework that I had to use in my own PHP code. Instead, I found out that it drops data directly into a database for me. Perfect. :]
I was a little frustrated at start when I ran the [php yapeal.php] script that I didn't see much activity in the database. I looked at the charAssetList after running the script and noted that it didn't add anything. After mucking around, found that I had to enable the option in the utilSections. I don't remember reading that anywhere. :( I have not had the chance to dive into the rest of the code yet, but maybe on the Wiki you could set aside some hints on how to get the ball rolling from a brand new install? Personally, I'd like to see a HINTS/TIPS section that'd give up some details on raw SQL queries to get some data out.
I've been working on coming up with a new Asset Manager (Since HeavyDuck isn't really doing much with his, and the old API system is going to be going bye bye, AND his UI is looking dated - NO OFFENSE!), and found your link about how things are done with the nested rowsets. Very VERY facinating (and new to me) method to say the least. The question I do have though is why you chose to go the route you did with this method of containing the data? The concept I get after looking at the external wiki you linked to, and its quite clear in my head, but, isn't it a bit overboard?
What I mean is, since a single item can only be placed in a container, on a ship, in a station, in the solar system, in the constellation, in the region, in the universe, that single item has a parent which is the container, and that container has a parent which is the ship, so on and so on. Standard Primary Key to Foreign Key relationship. No need for even an additional table since its a one to many relationship (But then again, a many to many relationship is just with an additional table linking O2M and M2O.)
Using your particular method (Which I am NOT putting down), if I wanted to find out what items I own are in a station, I'd first do a query to find all distinct itemID rows in a particular location. Now I'd make another query and find out what items are in that station, including GSCs, SWH, etc. But this is where things kind of get difficult to sort out at least on thrashing the database (Something I wish to avoid doing)
Here's an example of how I'm conceptualizing the pseudo code;
I have a Mammoth. The typeID for the ship is 652. Doing a query against this typeID gives me a lft value of 204 and rgt value of 315. So now my next query would want to run against all fields between lft and rgt of 204 and 315 respectively. This returns a count of 56 items in my case. I know I have 4 GSCs sitting on this ship. Each of these four containers are going to have their own lft and rgt values. Thing is, being a fore-thinker, I know that I'm going to have to re-query, or ignore somehow, the result set from the first query.
select lft,rgt from charAssetList where typeID=652; --Query #1 -- Have a list of all my mammoths - Which is one. Returns 204 & 315 select * from charAssetList where lft>204 and rgt<315 where ownerID={MycharID}; -- Query #2 -- First several rows return lft+1=rgt -- Skip a few of the result set, I now have the GSCs, so have to requery select * from charAssetList where lft>227 and rgt<310 where ownerID={MycharID}; -- Query #x -- Process this result set as usual ***
So now I'm stuck. I've already 'worked' on the items between 227 and 310 and now I have to "remember" that I've dealt with this particular set going down the rest of the rows from the query #2.
Am I looking at this right? |